package com.hk.webapp.service.impl;

import com.hk.webapp.bean.CmsCategory;
import com.hk.webapp.dao.CmsCategoryMapper;
import com.hk.webapp.vo.UpdateActionVo;
import com.hk.webapp.service.CmsCategoryService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional(readOnly = true)
public class CmsCategoryServiceImpl implements CmsCategoryService {

    @Resource
    private CmsCategoryMapper cmsCategoryMapper;

    @Override
    public List<CmsCategory> getEntityList() {
        return cmsCategoryMapper.getEntityList();
    }

    @Override
    public List<CmsCategory> getEntityListByIds(String ids) {
        return cmsCategoryMapper.getEntityListByIds(ids);
    }

    @Override
    @Transactional
    public int updateFieldValue(UpdateActionVo vo) {
        return cmsCategoryMapper.updateFieldValue(vo);
    }

    @Override
    public CmsCategory getEntityById(Integer id) {
        return cmsCategoryMapper.selectByPrimaryKey(id);
    }

    @Override
    @Transactional
    public int update(CmsCategory cmsCategory) {
        return cmsCategoryMapper.updateByPrimaryKeySelective(cmsCategory);
    }

    @Override
    @Transactional
    public int softDelByIds(List<Integer> ids) {
        return cmsCategoryMapper.softDelByIds(ids);
    }

    @Override
    @Transactional
    public int insert(CmsCategory cmsCategory) {
        return cmsCategoryMapper.insertSelective(cmsCategory);
    }

    @Override
    public List<CmsCategory> getEntityListByPid(Integer pid) {
        return cmsCategoryMapper.getEntityListByPid(pid);
    }

    @Override
    public CmsCategory getEntityByCode(String code) {
        return cmsCategoryMapper.getEntityByCode(code);
    }
}
